<template>
  <div style="height:100%;">
    <el-container style="border: 1px solid #eee">
      <el-aside width="200px" style="background-color: rgb(238, 241, 246)">
        <el-menu
          router
          :default-active="this.$router.path"
          unique-opened
          :default-openeds="['1']">
          <!-- <el-page-header @back="goBack" content="首页"></el-page-header> -->
          <el-menu-item index="home/index">
            <i class="el-icon-location"></i>
            <span slot="title">首页</span>
          </el-menu-item>
          <el-submenu index="1">
            <template slot="title">
              <i class="el-icon-document"></i>
              <span>会员档案</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="1-1">会员档案</el-menu-item>
              <el-menu-item index="1-2">体检上传</el-menu-item>
              <el-menu-item index="1-3">会员统计</el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="2">
            <template slot="title">
              <i class="el-icon-menu"></i>
              <span>预约管理</span>
            </template>
          <el-menu-item-group>
              <el-menu-item index="2-1">预约列表</el-menu-item>
              <el-menu-item index="2-2">预约设置</el-menu-item>
              <el-menu-item index="2-3">套餐管理</el-menu-item>
              <el-menu-item index="2-4">检查项管理</el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          
          <el-submenu index="3">
            <template slot="title">
              <i class="el-icon-menu"></i>
              <span>健康评估</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="3-1">体质测评</el-menu-item>
              <el-menu-item index="/home/mentalEvaluation">心理测评</el-menu-item>
              <el-menu-item index="3-3">风险测评</el-menu-item>
            </el-menu-item-group>
            </el-submenu>

            <el-submenu index="4">
            <template slot="title">
              <i class="el-icon-document"></i>
              <span>健康干预</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="3-1">人群分类</el-menu-item>
              <el-menu-item index="3-2">干预方案</el-menu-item>
              <el-menu-item index="3-3">随访日记</el-menu-item>
              <el-menu-item index="3-2">指标管理</el-menu-item>
              <el-menu-item index="3-3">模板管理</el-menu-item>
            </el-menu-item-group>
            </el-submenu>

            <el-submenu index="5">
            <template slot="title">
              <i class="el-icon-document"></i>
              <span>知识库</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="3-1">评估建议</el-menu-item>
              <el-menu-item index="3-2">健康方案</el-menu-item>
              <el-menu-item index="3-3">运动项目库</el-menu-item>
              <el-menu-item index="3-2">膳食库</el-menu-item>
              <el-menu-item index="3-3">疾病库</el-menu-item>
            </el-menu-item-group>
            </el-submenu>

            <el-submenu index="6">
            <template slot="title">
              <i class="el-icon-document"></i>
              <span>统计分析</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="3-1">工作量统计</el-menu-item>
            </el-menu-item-group>
            </el-submenu>

            <el-submenu index="7">
            <template slot="title">
              <i class="el-icon-setting"></i>
              <span>系统设置</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="3-1">菜单设置</el-menu-item>
              <el-menu-item index="3-2">权限管理</el-menu-item>
              <el-menu-item index="3-3">用户管理</el-menu-item>
              <el-menu-item index="3-2">题库管理</el-menu-item>
              <el-menu-item index="3-3">问卷管理</el-menu-item>
            </el-menu-item-group>
            </el-submenu>
        </el-menu>
      </el-aside>
      <el-container>
        <el-header style="text-align: right; font-size: 20px;background-color: whitesmoke;">
          <el-breadcrumb separator="/" style="text-align:center; font-size: 20px;">
            <el-breadcrumb-item :to="{ path: '' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item><a href="#">活动管理</a></el-breadcrumb-item>
            <el-breadcrumb-item>活动列表111</el-breadcrumb-item>
          </el-breadcrumb>
          <el-dropdown>
            <i class="el-icon-setting" style="margin-right: 15px"></i>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item>密码修改</el-dropdown-item>
              <el-dropdown-item @click.native="loginout"
                >安全退出</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
          <!-- <span>admin</span> -->
          <span>{{ username }}</span>
        </el-header>
        <el-main>
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
// @ is an alias to /src
// import HelloWorld from "@/components/HelloWorld.vue";

export default {
  data() {
      return {
        username:sessionStorage.getItem("name"),
      }
    },
    created() {
      console.log(sessionStorage.getItem("name"));
    },
  methods: {
    loginout() {
      alert("登出");
      this.$router.push("/login");
      sessionStorage.removeItem("name");
    }
  },
  created () {
    this.$router.push({path:"/home/index"})
    if(sessionStorage.getItem("name")==null){
    this.$router.push({path:"/login"})
    }
  }
};
</script>
